import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '@/views/Index'
import Login from "@/views/Login";
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '介绍页',
    component: Index,
    children: [
      {
        path: 'home',
        name: '首页',
        component: () => import('../views/Home')
      },
      {
        path: 'cookbook',
        name: '菜谱管理',
        component: () => import('../views/Cookbook')
      },
      {
        path: 'food',
        name: '菜品管理',
        component: () => import('../views/Food')
      },
      {
        path: 'comment',
        name: '评价管理',
        component: () => import('../views/Comment')
      },
      {
        path: 'order',
        name: '订单管理',
        component: () => import('../views/Order')
      },
      {
        path: 'user',
        name: '用户管理',
        component: () => import('../views/User')
      },
      {
        path: 'admin',
        name: '管理员管理',
        component: () => import('../views/Admin')
      },
      {
        path: 'role',
        name: '角色管理',
        component: () => import('../views/Role')
      }
    ]
  },
  {
    path: '/login',
    name: '登录页',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
